﻿// Decompiled by AS3 Sorcerer 6.78
// www.buraks.com/as3sorcerer

//com.wdcgame.engine.nape.NapeShapeFactory

package com.game.engine.nape
{
    import com.dusk.util.MathUtil;
    import com.game.engine.nape.utils.BodyDataTransUtil;
    import com.game.engine.nape.utils.CBTypes;
    import com.game.engine.nape.utils.CollisionGroup;
    import com.game.engine.nape.utils.TerrainBody;
    import com.game.engine.phys.RigidBody;
    import com.game.engine.phys.Vector2D;
    import com.game.tile.model.ObjectLayerVO;
    
    import flash.display.BitmapData;
    import flash.geom.Rectangle;
    
    import nape.geom.Vec2;
    import nape.phys.Body;
    import nape.phys.BodyType;
    import nape.phys.Material;
    import nape.shape.Circle;
    import nape.shape.Polygon;
    import nape.space.Space;
    
    public class NapeShapeFactory
    {

        private var _space:Space;

        public function NapeShapeFactory(_arg_1:Space)
        {
            _space = _arg_1;
            var _local_2:* = 0;
            _space.worldLinearDrag = _local_2;
            _space.worldAngularDrag = _local_2;
        }
        
        public function createByTmxLayer(...a):void
        {
        
        }

        /*public function createByTmxLayer(_arg_1:ObjectLayerVO, _arg_2:int=1):Vector.<GameObject>
        {
            var _local_16:int;
            var _local_6:* = null;
            var _local_20:* = null;
            var _local_14:GameObject = null;
            var _local_18:* = null;
            var _local_7:RigidBody = null;
            var _local_19:* = null;
            var _local_21:*;
            var _local_15:Number;
            var _local_3:Number;
            var _local_12:Number;
            var _local_5:Number;
            var _local_13:Number;
            var _local_9:Number;
            var _local_8:Number;
            var _local_11:Number;
            var _local_17:Vector.<GameObject> = new Vector.<GameObject>();
            var _local_10:Array = BodyDataTransUtil.createByTmx(_arg_1, _arg_2);
            _local_16 = 0;
            while (_local_16 < _local_10.length)
            {
                _local_6 = _local_10[_local_16];
                _local_20 = _local_6.objectVo;
                _local_14 = new GameObject();
                _local_14.data = _local_6;
                _local_14.tag = _local_6.label;
                _local_14.campId = -1;
                _local_14.name = _local_20.name;
                if (_local_20.properties.hasOwnProperty("tag"))
                {
                    _local_18 = _local_20.properties.tag.split(";");
                    for each (var _local_4:String in _local_18)
                    {
                        _local_14.addTags(_local_4);
                    }
                }
                _local_7 = new RigidBody(_local_6.bodyType, new Vector2D(_local_6.px, _local_6.py));
                if (_local_6.hasOwnProperty("material"))
                {
                    _local_19 = new Material();
                    _local_19.elasticity = _local_6.material.elasticity;
                    _local_19.density = _local_6.material.density;
                    _local_19.dynamicFriction = _local_6.material.dynamicFriction;
                    _local_19.rollingFriction = _local_6.material.rollingFriction;
                    _local_19.staticFriction = _local_6.material.staticFriction;
                }
                if (_local_6.shapeType == "Circle")
                {
                    _local_7.addCircleCollider(_local_6.width / 2, _local_6.width / 2, _local_6.width / 2, _local_19);
                }
                else
                {
                    if (_local_20.polygon)
                    {
                        _local_7.addPolygon(_local_20.polygonPoints, _local_19);
                    }
                    else
                    {
                        if (_local_6.bodyType == "st" && _local_20.rotation != 0)
                        {
                            _local_21 = new Vector.<Vector2D>();
                            _local_15 = _local_20.x;
                            _local_3 = _local_20.y;
                            _local_12 = _local_15 + (Math.cos(MathUtil.degreeToRadian(_local_20.rotation)) * _local_20.width);
                            _local_5 = _local_3 + (Math.sin(MathUtil.degreeToRadian(_local_20.rotation)) * _local_20.width);
                            _local_13 = _local_12 + (Math.cos(MathUtil.degreeToRadian(_local_20.rotation + 90)) * _local_20.height);
                            _local_9 = _local_5 + (Math.sin(MathUtil.degreeToRadian(_local_20.rotation + 90)) * _local_20.height);
                            _local_8 = _local_15 + (Math.cos(MathUtil.degreeToRadian(_local_20.rotation + 90)) * _local_20.height);
                            _local_11 = _local_3 + (Math.sin(MathUtil.degreeToRadian(_local_20.rotation + 90)) * _local_20.height);
                            _local_21.push(new Vector2D(_local_15 - _local_20.x, _local_3 - _local_20.y), new Vector2D(_local_12 - _local_20.x, _local_5 - _local_20.y), new Vector2D(_local_13 - _local_20.x, _local_9 - _local_20.y), new Vector2D(_local_8 - _local_20.x, _local_11 - _local_20.y));
                            _local_7.addPolygon(_local_21, _local_19);
                        }
                        else
                        {
                            _local_7.addBoxCollider(_local_6.width / 2, _local_6.height / 2, _local_6.width, _local_6.height, _local_19);
                        }
                    }
                }
                _local_7.collisionGroup = _local_6.collisionGroup;
                _local_7.sensorGroup = _local_6.collisionGroup;
                if (_local_6.label == "medge")
                {
                    if (_local_6.collisionMask2 > 0)
                    {
                        _local_7.collisionMask = _local_6.collisionMask2;
                    }
                }
                if (_local_7.collisionGroup == CollisionGroup.FLOOR)
                {
                    _local_7.addCbTypes(CBTypes.floorCbType);
                    Map.getIns().addFloor(_local_7);
                }
                if (_local_6.bodyType != BodyTypeConst.ST)
                {
                    _local_7.rotation = MathUtil.degreeToRadian(_local_20.rotation);
                }
                _local_14.addComponent(_local_7);
                _local_17.push(_local_14);
                _local_16++;
            }
            return _local_17;
        }*/
    }
}